import React, { Component } from 'react'
import qs from 'qs'
const DetailData = [
    {id:'01',content:'你好，中国'},
    {id:'02',content:'你好，React'},
    {id:'03',content:'你好，未来的自己'},
]
export default class Detail extends Component {
  render() {
    const {id,title} = qs.parse(this.props.location.search.slice(1))
    const findDetail = DetailData.find((detailObj)=>{
        return detailObj.id===id
    })
    return (
      <div>
        <ul>
            <li>ID:{id}</li>
            <li>Content:{findDetail.content}</li>
            <li>Title:{title}</li>
        </ul>
      </div>
    )
  }
}
